<?php

/**
 * Created by PhpStorm.
 * User: LG
 * Date: 2018/8/3
 * Time: 11:22
 */

namespace app\common\model;

use think\Model;

class EquipmentLibrary extends Model {

    protected $name = 'equipment_library';

    public function getOne($where) {
        // 根据条件 $where 查询单条数据
        $userInfo = $this->where($where)->find();
        // 判断结果 并返回
        if ($userInfo == false) {
            return false;
        }
        return $userInfo;
    }

    // 添加操作
    public function add($data) {
        $result = $this->insertGetId($data);
        return $result;
    }

    // 编辑操作
    public function edit($where, $data) {
        $result = $this->where($where)->update($data);
        return $result;
    }

}
